<?php if ($cats): ?>
<ul class="list categories">
<?php foreach ($cats->result() as $cat): ?>
	<li id="ctgy_<?php echo $cat->id; ?>">
		<a href="/entries/categorized/<?php echo $cat->id; ?>"><?php echo $cat->name; ?></a>
	<?php if ($this->userland->logged_in() && $this->Membership_model->is_owner($bricabox->id)): ?>
		<a class="delete" style="border: none;" href="#" onclick="return Ctgy.removeCat(<?php echo $cat->id; ?>, <?php echo $block_instance['data']->id; ?>, <?php echo $bricabox->id; ?>);"><img style="vertical-align: middle;" src="/assets/images/icons/cross.png" alt="Delete" /></a>
	<?php endif; ?>
	</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>

<?php if ($this->Membership_model->is_owner($bricabox->id)): ?>
<div class="block_header">
	<div id="block_prefs_<?php echo $block_instance['data']->id; ?>" style="display: none;">
		<?php if ($this->userland->logged_in() && $this->Membership_model->is_owner($bricabox->id)): ?>
		<div id="add_ctgy_<?php echo $block_instance['data']->id; ?>">
			<label for="ctgy_name_<?php echo $block_instance['data']->id; ?>">Add a new category:</label>
			<input type="text" name="ctgy_name" id="ctgy_name_<?php echo $block_instance['data']->id; ?>" />
			<input type="submit" value="Ok" onclick="return Ctgy.addCat(<?php echo $block_instance['data']->id; ?>, <?php echo $bricabox->id; ?>);" />
			or <a href="#" onclick="return PrefPane.toggle(<?php echo $block_instance['data']->id; ?>);">cancel</a>
		</div>
		<?php endif; ?>
	</div>
</div>
<?php endif; ?>